package com.qingzhu.util;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;

public class CreatedAlipayClient {
    private static AlipayClient alipayClient;   // 支付宝客户端

    private static String serverUrl;           // 支付宝网关
    private static String appId;               // 商家的APPID
    private static String appPrivateKey;       // 开发者私钥(由开发者生成)
    private static String alipayPublicKey;     // 支付宝公钥(由支付宝生成)
    private static String format;              // 参数返回格式
    private static String charset;             // 请求和签名使用的编码格式
    private static String signType;            // 商户生成签名字符串所使用的签名类型

    static {
        serverUrl = "https://openapi.alipaydev.com/gateway.do";
        appId = "2021000117682884";
        appPrivateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCDQQQEpU6j9PcGoPpG/ftbSwW/XJVhaHW+Uy0GEB1fSPn5kafjeHsdJJvb2P4ZUTPS731FqJOD+/I1rHNuNuEUpKeMuwBxozXNU375p7Kh9oPgIF//HkhDANJelr5Kzi+RuqAmfp6qCEX8vcO10TObrZBpnlvWGzFJCnnzD8lkPuWvbD9wVXvoz6ESpdS7BSLPsjzcGXcUL6l3mDJyaK2qL3olpo+0lN5FT9NX/4G3BPJqrKt8rhW4PJlflKkwjPNFm3I8k6EjGWmwS1lqLz2yDQcAgUQoe0d8+pdyIePfWHVQ2JZNs/IJWAOgQhRzO0p4nc3u/KCXiktcPoClDbaZAgMBAAECggEAVsp/JbNJtREe57s6xAbeVxfczRUjki3I7fmCJCgzw/Y1ldnC8p+QiUzT4yQxofwYELtcUtuN8BCBsQw/p/mSDFx0jpJ5UKtjwEoeBGfnr0GbInFGCSS1E9lPQkzbuAtvWSXXEJ1ZvYWLAf1ZlLipL6Athim5AHMqu+m5igg+W5JpRruB+LX98QzzQT6o4C9Tqg7NgFWNdHR9lyQ1fPmPxHxPo4zKGjRdwzn5u/Od0ppDwCsweLUPjDH2z/y05rVf64Sz7N/Zn3ovXrC7oO/nu24EH/BqPby2hn3DYPkhmWivAq+JQD44d+zB0IfB966T+cPEnLPZf7a2wo3Vz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JcCv1adCfdOWdRjttKj2H6GterXIviT2wM8L6sWFXvc6LXzfqKE9oPh1BZ98uYvo6VaUsGufKUE5PHjPQz3YDLLMnAaMwulcaAmPPZhgO+z2h5ECsJYlk9QfaOCjMUHPC9wz+cYQx6UcCU2Uk/2ATg29PqVHenyBnmE5DVAWNVUA0q0oFx8z/QMphJx2AAwIDAQAB";
        format = "json";
        charset = "utf-8";
        signType = "RSA2";
        alipayClient = new DefaultAlipayClient(serverUrl,appId,appPrivateKey,format,charset,alipayPublicKey,signType);
    }

    // 获取支付宝客户端对象
    public AlipayClient getAlipayClient () {
        return alipayClient;
    }
}
